/*
 * RegistrationForm.java
 *
 * Created on 8  2007 ., 19:56
 */

package server.reqistration;

import javax.servlet.http.HttpServletRequest;
import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionMessage;

/**
 *
 * @author alexog
 * @version
 */

public class RegistrationForm extends org.apache.struts.action.ActionForm {
    
    private String username;
    
    private String password;
    
    private String firstName;
    
    private String lastName;
    
    private String email;
    
    private String seqQuestion;
    
    private String seqAnswer;
        
    /**
     * @return
     */
    public String getUsername() {
        return username;
    }
    
    /**
     * @param string
     */
    public void setUsername(String string) {
        username = string;
    }   

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getFirstName() {
        return firstName;
    }

    public void setFirstName(String firstName) {
        this.firstName = firstName;
    }

    public String getLastName() {
        return lastName;
    }

    public void setLastName(String lastName) {
        this.lastName = lastName;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public String getSeqQuestion() {
        return seqQuestion;
    }

    public void setSeqQuestion(String seqQuestion) {
        this.seqQuestion = seqQuestion;
    }

    public String getSeqAnswer() {
        return seqAnswer;
    }

    public void setSeqAnswer(String seqAnswer) {
        this.seqAnswer = seqAnswer;
    }
    
     /**
     *
     */
    public RegistrationForm() {
        super();
    }
    
    public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) {
        ActionErrors errors = new ActionErrors();
        if (getUsername() == null || getUsername().length() < 1) {
            errors.add("name", new ActionMessage("error.name.required"));
            //TODO:Add other validation
        }
        return errors;
    }
}
